//
//  MXTextField.swift
//  XMPPTest
//
//  Created by 陈学明 on 17/2/10.
//  Copyright © 2017年 muxue. All rights reserved.
//

import UIKit

class MXTextField: UIView {
    var textField:UITextField? = nil
    var name:String?
    

    init(title:String,placeholder:String) {
        super.init(frame: CGRect.zero)
        self.textField = UITextField()
        self.textField?.backgroundColor = UIColor.white
        self.addSubview(self.textField!)
        self.textField?.placeholder = placeholder
        self.textField?.borderStyle = .line
        let titlable:UILabel = UILabel()
        titlable.text = title
        self.addSubview(titlable)
        
        titlable.sd_layout()
            .leftSpaceToView(self,5)?
            .topSpaceToView(self,0)?
            .heightRatioToView(self,1.0)?
            .widthIs(70)
        
//        titlable.setSingleLineAutoResizeWithMaxWidth(100)
        
        self.textField?.sd_layout()
            .leftSpaceToView(titlable ,5)?
            .topSpaceToView(self,0)?
            .rightSpaceToView(self,0)?
            .heightRatioToView(self,1.0)
    }
    
    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }

//    init(title:String,placeholder:String) {
//        

//        
//
//        
//    }
    
//    required init?(coder aDecoder: NSCoder) {
//        fatalError("init(coder:) has not been implemented")
//    }
    
}


